<template>
  <a-button
    :size="size"
    :ghost="!!type && type != 'primary' && type != 'default'"
    :type="type == 'danger' ? 'primary' : type"
    :disabled="disabled"
    @click="clickCallback"
  >
    <i v-if="icon" :class="['gcticons', icon, 'mr-2']"></i>
    {{ text }}
  </a-button>
</template>

<script>
  export default {
    name: 'g-btn',
    props: {
      size: {
        default: 'default',
      },
      type: {
        default: 'default',
      },
      text: {},
      disabled: { default: false },
      icon: {},
      eventName: {},
    },
    data() {
      return {};
    },
    methods: {
      clickCallback(e) {
        this.$emit('callback', this.eventName);
        // 阻止form提交
        e.preventDefault();
        e.stopPropagation();
        return false;
      },
    },
  };
</script>

<style scoped></style>
